{% extends 'TopxiaWebBundle:Coin:layout.html.twig' %}
{% block title %}我的邀请码 - {{ parent() }}{% endblock %}

{% set side_nav = 'my-invite-code' %}

{% block main %}
  <div class="es-section ">
  {% include 'TopxiaWebBundle:Coin:bill-bar.html.twig' %}
  {% if setting('invite.invite_code_setting') == 1 %}
    <p class="clearfix">
    <span class="label label-primary label-md mrl">我的邀请码</span><span class="mrl text-xlg">{{code}}</span>
    {% if record == null %}
    <a  class="btn btn-primary btn-sm pull-right mlm" href="#modal" data-toggle="modal" id="writeInvite" data-url="{{ path('write_invitecode')}}">TA的邀请码</a>
    {% endif %}
    <a  class="btn btn-primary btn-sm pull-right" href="#modal" data-toggle="modal" data-url="{{ path('invite_promote_link')}}">邀请好友</a></p>
    <br>
    <div class="alert alert-warning">
    给TA分享您的邀请码或者邀请链接
    {% if inviteSetting %}
      {% if inviteSetting.promoted_user_value  %}
      ，TA注册后将获得{{inviteSetting.promoted_user_value}}元优惠券
      {% endif %}
      {% if inviteSetting.promote_user_value %}
      ，TA在消费后您将获得{{inviteSetting.promote_user_value}}元优惠券
      {% endif %}
    。  
    {% else %}
    。
    {% endif %}
    </div>
    

<table class="table table-striped table-hover" id="course-table" style="word-break:break-all;">
  <thead>
    <tr>
      <th>邀请对象</th>
      <th>邀请时间</th>
      <th>邀请奖励</th>
      <th>奖励获取时间</th>
    </tr>
  </thead>
  <tbody>
      {% for user in invitedUsers %}
      <tr>
        <td>{{user.nickname}}</td>
        <td>{{user.inviteTime|date('Y-m-d H:i:s')}}</td>
        <td>{{user.rewardRate|default('-')}}</td>
        <td>{{user.inviteRewardTime|default('-')}}</td>
      </tr>
      {% else %}
        <tr><td colspan="20"><div class="empty">暂无邀请用户</div></td></tr>
      {% endfor %}
  </tbody>
</table>
  {{ web_macro.paginator(paginator) }}


  {% else %}
  <div class="well" style="text-align:center;">
    邀请码功能已关闭
  </div>
  {% endif %}
  </div>
{% endblock %}